<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
	<script src="{yun:}$config.sy_weburl{/yun}/js/jquery-1.8.0.min.js?v={yun:}$config.cachecode{/yun}"></script>
	<script src="js/admin_public.js?v={yun:}$config.cachecode{/yun}" language="javascript"></script>

	<link href="{yun:}$config.sy_weburl{/yun}/js/layui/css/layui.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet">
	<link href="images/reset.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />
	<link href="images/system.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />
	<link href="images/table_form.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />

	<title>后台管理</title>
</head>

<body class="body_ifm">
	
	<form action="index.php?m=admin_message&c=show" method="post" id='checkform' >
		<input type="hidden" name="userid" id="userid" value="">
		<input type="hidden" name="pytoken" value="{yun:}$pytoken{/yun}">
	</form>
	 
	<div class="infoboxp">
		
		<div class="admin_new_tip">
			<div class="admin_new_tit"><i class="admin_new_tit_icon"></i>操作提示</div>
			<div class="admin_new_tip_list_cont">
				<div class="admin_new_tip_list">该页面展示了CRM业务员业务数据 。</div>
			</div>
		</div>
		
	

		<div class="admin_new_search_box">
			
			<form action="index.php" name="myform" method="get" class="layui-form"> 
				
				<input name="m" value="crm_statis" type="hidden"/>
				
				<div class="layui-form-item">

  					<label class="layui-form-label">搜索类型</label>

					<div class="admin_Filter_text formselect" did='dkeytype'>
			
						<input type="button" {yun:}if $get_type.keytype==''||$get_type.keytype=='1'{/yun} value="用户名"  {yun:}elseif $get_type.keytype=='2'{/yun} value="业务员姓名"  {yun:}elseif $get_type.keytype=='3'{/yun} value="业务员ID" {yun:}/if{/yun} class="admin_Filter_but" id="bkeytype">
			
						<input type="hidden" name="type" id="keytype" {yun:}if $get_type.keytype==''||$get_type.keytype=='1'{/yun} value="1"  {yun:}elseif $get_type.keytype=='2'{/yun} value="2" {yun:}elseif $get_type.keytype=='3'{/yun} value="3" {yun:}/if{/yun}/>
			
						<div class="admin_Filter_text_box" style="display:none" id="dkeytype">
							<ul> 
								<li><a href="javascript:void(0)" onClick="formselect('1','keytype','用户名')">用户名</a></li>
								<li><a href="javascript:void(0)" onClick="formselect('2','keytype','业务员姓名')">业务员姓名</a></li>
								<li><a href="javascript:void(0)" onClick="formselect('3','keytype','业务员ID')">业务员ID</a></li>
							</ul>
						</div>
					</div>

					<input type="text" value="" placeholder="请输入你要搜索的关键字" name='keyword'class="layui-input" style="width:200px;">
				
				</div>

 				<div class="layui-form-item">
					
					<label class="layui-form-label">查询范围</label>
					
					<div class="layui-input-inline">
						<input type="text" class="layui-input" id="time" name="time" style="width:300px;">
					</div>
 
					<div class="layui-input-inline">
						<input name="radio_time" value="0" title="今天" type="radio" lay-filter="radio_time"
		        {yun:}if $radio_time == '0'{/yun}
		        checked
		        {yun:}/if{/yun}
		        />
		        <input name="radio_time" value="1" title="昨天" type="radio" lay-filter="radio_time"
		        {yun:}if $radio_time == '1'{/yun}
		        checked
		        {yun:}/if{/yun}
		        />
		        <input name="radio_time" value="7" title="7天内" type="radio" lay-filter="radio_time"
		        {yun:}if $radio_time == '7'{/yun}
		        checked
		        {yun:}/if{/yun}
		        />
		        <input name="radio_time" value="30" title="30天内" type="radio" lay-filter="radio_time"
		        {yun:}if $radio_time == '30' || $radio_time == '-2'{/yun}
		        checked
		        {yun:}/if{/yun}
		        />
		        <input name="radio_time" value="90" title="90天内" type="radio" lay-filter="radio_time"
		        {yun:}if $radio_time == '90'{/yun}
		        checked
		        {yun:}/if{/yun}
		        />
		        <input name="radio_time" value="-1" title="全部" type="radio" lay-filter="radio_time"
		        {yun:}if $radio_time == '-1'{/yun}
		        checked
		        {yun:}/if{/yun}
		        />
						<input type="hidden" name="isAllTime" id="isAllTime" value="0"/>
					</div>

					<div class="layui-input-inline">
						<button class="layui-btn" lay-filter="query" >点击查询</button>
					</div>

				</div>
				<!-- <input type="submit" value="搜索" name='search'  class="admin_new_bth"> -->
 			</form>
			{yun:}include file="admin/admin_search.htm"{/yun}
 		</div>  

		<div class="clear"></div> 
		
		<div class="table-list">
			<div class="admin_table_border">
				<iframe id="supportiframe"  name="supportiframe" onload="returnmessage('supportiframe');" style="display:none"></iframe>
				<form action="index.php"  target="supportiframe" name="myform" method="get" id='myform'>
					<input name="m" value="user_member" type="hidden"/>
					<input name="c" value="del" type="hidden"/>
					
					<table width="100%">
						<thead>
							<tr class="admin_table_top">
								<th style="width:20px;">
									<label for="chkall"> <input type="checkbox" id='chkAll'  onclick='CheckAll(this.form)'/> </label>
								</th>

								<th align="left"> 
									{yun:}if $smarty.get.t=="uid" && $smarty.get.order=="desc"{/yun} 
										<a href="index.php?m=crm_statis&order=asc&t=uid">用户ID<img src="images/sanj2.jpg"/></a> 
									{yun:}else{/yun} 
										<a href="index.php?m=crm_statis&order=desc&t=uid">用户ID<img src="images/sanj.jpg"/></a> 
									{yun:}/if{/yun}
								</th>

								<th align="left">姓名/用户名</th>
								<th align="left">客户总数</th>
								<th align="left">待关怀客户</th>
								<th align="left">已关怀客户</th>
								<th align="left">待回访客户</th>
								<th align="left">签单数</th>
								<th align="left">
									签单金额（元）
								</th>
								<th class="admin_table_th_bg">业务详情</th>
							</tr>
						</thead>

						<tbody>
							{yun:}foreach item=v key=key from=$userrows{/yun}
								<tr {yun:}if ($key+1)%2=='0'{/yun}class="admin_com_td_bg"{yun:}/if{/yun} id="list{yun:}$v.uid{/yun}">
									<td width="20">
										<input type="checkbox" value="{yun:}$v.uid{/yun}" class="check_all"  name='del[]' onclick='unselectall()' rel="del_chk" style="margin-left:5px;"/>
									</td>
									<td align="left" class="td1" style=" width:60px;">{yun:}$v.uid{/yun}</td>
									<td align="left">
										{yun:}$v.name{/yun}
										<div class="mt5">{yun:}$v.username{/yun}</div>
									</td>
									<td align="left">{yun:}$v.concernNum+$v.concernedNum{/yun}</td>
									<td align="left">{yun:}$v.concernNum{/yun}</td>
									<td align="left">{yun:}$v.concernedNum{/yun}</td>
									<td align="left">{yun:}$v.returnVisitNum{/yun}</td>
									<td align="left">{yun:}$v.orderNum{/yun}</td>
									<td align="left">{yun:}$v.orderPrice{/yun}</td>
									<td width="120">
										<div class="admin_new_bth_c">
											<a href="index.php?m=crm_statis&c=performance&uid={yun:}$v.uid{/yun}" class="admin_new_c_bth admin_new_c_bthsh" style="width: 60px;margin-bottom: 5px;">查看详情</a>
										</div>
									</td>
								</tr>
							{yun:}/foreach{/yun}

							<tr style="background:#f1f1f1;">
								<td align="center"><input type="checkbox" id='chkAll2' onclick='CheckAll2(this.form)' /></td>
								<td colspan="4" ><label for="chkAll2">全选</label></td>
								<td colspan="8" class="digg">{yun:}$pagenav{/yun}</td>
							</tr>
						</tbody>
					</table>

					<input type="hidden" name="pytoken" id='pytoken' value="{yun:}$pytoken{/yun}">
				</form>
			</div>
		</div>
	</div>

<script src="{yun:}$config.sy_weburl{/yun}/js/layui/layui.js?v={yun:}$config.cachecode{/yun}" language="javascript"></script>
<script src="{yun:}$config.sy_weburl{/yun}/js/layui/phpyun_layer.js?v={yun:}$config.cachecode{/yun}"></script>

<script>
function getDateTimeStr(timestamp){
	var d = new Date(timestamp);    //根据时间戳生成的时间对象
	var h = d.getHours(),
		m = d.getMinutes(),
		s = d.getSeconds(),
		month = d.getMonth() + 1,
		day = d.getDate();

	h = h < 10 ? '0' + h : h;
	m = m < 10 ? '0' + m : m;
	s = s < 10 ? '0' + s : s;
	
	month = month < 10 ? '0' + month : month;
	day = day < 10 ? '0' + day : day;
	
	return (d.getFullYear()) + "-" + month + "-" + day + " " + h + ":" + m + ":" + s;
}

function getToday(){
  var today = new Date();
  
  today.setHours(0);
  today.setMinutes(0);
  today.setSeconds(0);
  today.setMilliseconds(0);
  
  return today;
}

layui.use(['form', 'laydate'], function(){
	var laydate = layui.laydate,
		form = layui.form,
		$ = layui.$;

		laydate.render({
			elem : '#time',
			type : 'datetime',
			range : '~',
			value : '{yun:}$defaultTime{/yun}'
		});

	form.on('radio(radio_time)', function(data){
		if(data.value == -1){
			$('#isAllTime').val(1);
			$("#time").val('');
		}else{
			$('#isAllTime').val(0);

			var today = getToday();
			var diff = 1000 * 60 * 60 * 24 * data.value;
			var day = new Date(today - diff);
			var str = getDateTimeStr(Date.parse(day)) + ' ~ ' + getDateTimeStr(Date.parse(new Date()));
      
			$("#time").val(str);
		}        
	});
});
</script>
{yun:}include file="$adminstyle/checkdomain.htm"{/yun}
</body>
</html>
